package com.flute.framework.autoprompt;

import java.util.HashMap;
import java.util.Map;

public class WordCategory{
	private Map<String, Integer> cats;
	private Map<Integer, String> keys;
	private int count;
	private int resultSize;

	public WordCategory() {
		this.cats = new HashMap<String, Integer>();
		this.keys = new HashMap<Integer, String>();
		this.count = 0;
	}

	public void addCategory(String category) {
		if (!cats.containsKey(category)) {
			cats.put(category, count);
			keys.put(count, category);
			count++;
		}
	}

	public boolean containsKey(String key) {
		return cats.containsKey(key);
	}

	public String[] getAllKeys() {
		return cats.keySet().toArray(new String[] {});
	}

	public int getCount() {
		return count;
	}

	public String getCategoryName(int key) {
		return keys.get(key);
	}

	public int getCategoryKey(String category) {
		if (category == null) {
			return 0;
		}
		addCategory(category);
		return cats.get(category);
	}

	public int getResultSize() {
		return resultSize;
	}

	public void setResultSize(int resultSize) {
		this.resultSize = resultSize;
	}
}
